home *** CD-ROM | disk | FTP | other *** search
/ APC & TCP 4 / APC & TCP 4.iso / games / publicdomain / a / attacks / sources / attacksgraphics.def < prev    next >
Text File  |  1994-05-14  |  12KB  |  213 lines

  1. DEFINITION MODULE attacksgraphics;
  2.  
  3.  
  4. (*   I am using the data hiding capabilities of modula-2 to simplify my   *)
  5. (* life for this project.  Anything that the main or other routines could *)
  6. (* want to do graphically will be through routines declared here.  To     *)
  7. (* sum, this is the heart of the graphics routines, simplified to only    *)
  8. (* the logical necessities.                                               *)
  9. (*                                                                        *)
  10. (*      Scott Biggs                                                       *)
  11.  
  12.  
  13. FROM header
  14.   IMPORT   boardtype, playertype, squaretype, boardrange, pointercode,
  15.            movetype, printmsgtype;
  16. FROM SYSTEM
  17.   IMPORT   ADDRESS;
  18. FROM Intuition
  19.   IMPORT   WindowPtr;
  20.  
  21.  
  22. (**************************************************************************)
  23. PROCEDURE InitializeScreen() : BOOLEAN;
  24.  
  25. (*      Starts the graphix running.                                    *)
  26. (* Sets up all the graphics variables AND draws the first graphics     *)
  27. (* that will be presented.  It returns true IF all the actions worked, *)
  28. (* false otherwise.                                                    *)
  29. (*                                                                     *)
  30. (*   INPUT                                                             *)
  31. (*            n/a                                                      *)
  32. (*                                                                     *)
  33. (*   OUTPUT                                                            *)
  34. (*            Returns a boolean value that tells IF the operation was  *)
  35. (*            succussful or not.  If successful, the screen (along     *)
  36. (*            with the accompanying graphics) is started.              *)
  37.  
  38.  
  39. (**************************************************************************)
  40. PROCEDURE CleanupGraphics;
  41.  
  42. (*      Stops the graphix AND deallocates all graphix allocated        *)
  43. (* memory.  It assumes that the graphics HAS been succussfully initi-  *)
  44. (* ated.                                                               *)
  45. (*                                                                     *)
  46. (*   INPUT                                                             *)
  47. (*            n/a                                                      *)
  48. (*                                                                     *)
  49. (*   OUTPUT                                                            *)
  50. (*            n/a                                                      *)
  51.  
  52.  
  53.  
  54. (**************************************************************************)
  55. PROCEDURE ShowAbout;
  56.  
  57. (*   Simply displays a message about the programmer and then waits for *)
  58. (* a mouse click to then erase this new display and return to the old  *)
  59. (* one.                                                                *)
  60.  
  61.  
  62.  
  63. (**************************************************************************)
  64. PROCEDURE ChangePointer (code : pointercode);
  65.  
  66. (*      This changes the mouse pointer.  The code determines what the  *)
  67. (* pointer is changed to.                                              *)
  68. (*                                                                     *)
  69. (*   INPUT                                                             *)
  70. (*            code        This variable is of the enumerated type,     *)
  71. (*                        pointercode.  It consists of RedCircle,      *)
  72. (*                        BlueCircle, and Default.  The Default code   *)
  73. (*                        tells this routine to restore the pointer    *)
  74. (*                        to whatever it was when the program was      *)
  75. (*                        started.                                     *)
  76. (*                                                                     *)
  77. (*   OUTPUT                                                            *)
  78. (*            The mouse pointer is immediately changed to the desired  *)
  79. (*            pointer.                                                 *)
  80.  
  81.  
  82. (**************************************************************************)
  83. PROCEDURE PrintMsg (msg : printmsgtype);
  84.  
  85. (*   Prints the message at the top of the screen.  This procedure should  *)
  86. (* not be confused with the procedure PrintTurn, which displays who's     *)
  87. (* turn it is to play.                                                    *)
  88. (*                                                                        *)
  89. (*   INPUT                                                                *)
  90. (*            msg                  This is which message to display.      *)
  91. (*                                                                        *)
  92. (*   OUTPUT                                                               *)
  93. (*            The screen is changed to display the desired message.       *)
  94.  
  95.  
  96. (**************************************************************************)
  97. PROCEDURE ShowScore (redscore : CARDINAL; bluescore : CARDINAL);
  98.  
  99. (*      Displays the scores.                                           *)
  100. (*                                                                     *)
  101. (*   INPUT                                                             *)
  102. (*            redscore    The number of squares occupied by the red    *)
  103. (*                        player.                                      *)
  104. (*                                                                     *)
  105. (*            bluescore   The number of squares occupied by the blue   *)
  106. (*                        player.                                      *)
  107. (*                                                                     *)
  108. (*   OUTPUT                                                            *)
  109. (*            The screen is modified to display the scores.            *)
  110.  
  111.  
  112. (**************************************************************************)
  113. PROCEDURE PrintTurn (player : playertype);
  114.  
  115. (*      Displays whose turn it is by the message on the top of the     *)
  116. (* screen                                                              *)
  117. (*                                                                     *)
  118. (*   INPUT                                                             *)
  119. (*            player      The player whose turn it now is.             *)
  120. (*                                                                     *)
  121. (*   OUTPUT                                                            *)
  122. (*            The screen is modified to display whose turn it is.      *)
  123.  
  124. (**************************************************************************)
  125. PROCEDURE DrawBoard (board : boardtype);
  126.  
  127. (*      Replaces the current display with the given board.             *)
  128. (*                                                                     *)
  129. (*   INPUT                                                             *)
  130. (*            board       A variable OF boardtype that describes the   *)
  131. (*                        contents of every location of a board.       *)
  132. (*                                                                     *)
  133. (*   OUTPUT                                                            *)
  134. (*            The screen is modified to display the contents of the    *)
  135. (*            input data.                                              *)
  136.  
  137.  
  138. (***********************************************************************)
  139. PROCEDURE DrawSquare (xloc : boardrange; yloc : boardrange;
  140.                       square : squaretype);
  141.  
  142. (*      This routine modifies only a single square, rather than the    *)
  143. (* whole board like the DrawBoard routine does.  Considering the upper *)
  144. (* left corner as square (1,1), this routine will replace the given    *)
  145. (* square with the specified item (either a block, empty, red, or      *)
  146. (* blue).                                                              *)
  147. (*                                                                     *)
  148. (*   INPUT                                                             *)
  149. (*            xloc, yloc     These two numbers describe the location   *)
  150. (*                           of the square to change.                  *)
  151. (*